//
// Created by wangwanlong on 2024/11/1.
//

#ifndef MKAHYPAR_POLICY_REGISTRY_H
#define MKAHYPAR_POLICY_REGISTRY_H
namespace mkahypar {
  namespace meta {
    class PolicyBase {
    public:
      PolicyBase() = default;

      PolicyBase(const PolicyBase&) = default;
      PolicyBase& operator= (const PolicyBase&) = default;

      PolicyBase(PolicyBase&&) = default;
      PolicyBase& operator= (PolicyBase&&) = default;

      virtual ~PolicyBase() = default;
    };

//    template <typename IDType>
//    class PolicyRegistry {
//    private:
//      using PolicyBasePtr = std::unique_ptr<PolicyBase>;
//      using UnderlyingIDType = typename std::underlying_type_t<IDType>;
//      using PolicyMap = std::unordered_map<UnderlyingIDType, PolicyBasePtr>;
//
//    public:
//      bool registerObject(const IDType& name, PolicyBase* policy) {
//        return _policies.emplace(
//                static_cast<UnderlyingIDType>(name), PolicyBasePtr(policy)).second;
//      }
//      static PolicyRegistry & getInstance() {
//        static PolicyRegistry instance;
//        return instance;
//      }
//
//      PolicyBase & getPolicy(const IDType& name) {
//        const auto it = _policies.find(static_cast<UnderlyingIDType>(name));
//        if (it != _policies.end()) {
//          return *(it->second.get());
//        }
//        LOG << "Invalid policy identifier";
//        std::exit(-1);
//      }
//
//    private:
//      PolicyRegistry() :
//              _policies() { }
//      PolicyMap _policies;
//    };
  }  // namespace meta
}  // nam
#endif //MKAHYPAR_POLICY_REGISTRY_H
